package com.shkco.controller;

import com.shkco.result.JSONResult;
import com.shkco.service.IUserService;
import com.shkco.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @GetMapping("/findAllUser")
    public JSONResult findAllUser(){
        return JSONResult.success(userService.findAllUser());
    }

    @GetMapping("/findById/{id}")
    public User findById(@PathVariable("id") Long id){
        return userService.findById(id);
    }

    @PostMapping("/update")
    public void update(User user){
        userService.update(user);
    }
}
